<template>
  <div class="dashboard-editor-container">


  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
import LineChartOfDynamic from './dashboard/LineChartOfDynamic'

import { getLoginLineChart } from "@/api/monitor/logininfor";

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'Index',
  components: {
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart,
    LineChartOfDynamic
  },
  created() {
    console.log("created start");
    // this.getLoginLineChart();
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis ,
      chartData: {
        // ['星期一','星期二','星期三','星期四','星期五','星期六','星期日']
        xaxisData: [],
        // [{'name':'登录人数','data':[10,50,32,54,12,86,50]}]
        yaxisData: [],
        // y轴数据格式化方法,自定义传入,没有方法传null
        yAxisFormatFunction: null
      },

    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    },
    /** 查询登录日志 */
    getLoginLineChart() {
      getLoginLineChart().then( response => {
        this.chartData = response.data;
        }
      );
    },



  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 16px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    //margin-bottom: 16px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
